%% Pore scale escape rate
clear all; close all;
%%%%%%%%%%%%%%%%%%%% root
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
root = 'D:\';
%%%%%%%%%%
%% Experimental data

load([root,'Compilation DiodeNatCom\figure 2\escape_expm.mat']);

H = 5.5;
W = 76/40*H;
margin = 0.75;
hFig = figure('color',[1,1,1],'Units','centimeter','Position',[4,4,W+2*margin,H+2*margin]); 
ax = axes('Units','centimeters');
ax.Position = [margin,margin, W, H];
box on;
hold on

errorbar(expm(1).x,expm(1).y,expm(1).err,'bo','LineWidth',1.5,'MarkerFaceColor','w');
errorbar(expm(2).x,expm(2).y,expm(2).err,'ro','LineWidth',1.5,'MarkerFaceColor','w');
errorbar(expm(3).x,expm(3).y,expm(3).err,'LineStyle','none','color',[0,0.75,0],'Marker','o','LineWidth',1.5,'MarkerFaceColor','w');
plot(expm(3).x2,expm(3).y2,'LineStyle','none','color',[0,0.75,0],'Marker','o','LineWidth',1.5);

%% Simulations


load([root,'Compilation DiodeNatCom\figure 2\escape_simu.mat']);
color_sim = [[0,0,1];[1,0,0];[0,0.75,0]];
for rr=1:3
plot(sim(rr).x,sim(rr).y,'color',color_sim(rr,:),'LineStyle','-','LineWidth',1.5);
end
'fin'
xlim([135-650,135]);
ylim([0,1]);
    
%% Rule of thumb

Phis = [1,1.3,1.8,2.5];
colorPhis = [[0,0,0];[0,0,1];[1,0,0];[0,0.75,0]];

for i=1:4
    plot(135*[1-Phis(i),1-Phis(i)],[-1000,1000],'color',colorPhis(i,:),'LineWidth',1.4,'LineStyle','--');
end


